package com.springboot.frame.comm.database;

import com.springboot.frame.comm.database.provider.H2SqlProvider;
import com.springboot.frame.comm.database.provider.MySqlSqlProvider;
import com.springboot.frame.comm.database.provider.OracleSqlProvider;
import com.springboot.frame.comm.database.provider.SqlProvider;
import com.springboot.frame.comm.database.registry.MysqlTypeRegistry;
import com.springboot.frame.comm.database.registry.OracleTypeRegistry;
import com.springboot.frame.comm.database.registry.TypeRegistry;
import lombok.Getter;

/**
 * @author madman
 */
@Getter
public enum Database {
  /**
   * MYSQL
   */
  MYSQL("com.mysql.jdbc.Driver", MySqlSqlProvider.INSTANCE, MysqlTypeRegistry.INSTANCE),
  /**
   * H2
   */
  H2("org.h2.Driver", H2SqlProvider.INSTANCE, MysqlTypeRegistry.INSTANCE),
  /**
   * ORACLE
   */
  ORACLE("oracle.jdbc.driver.OracleDriver", OracleSqlProvider.INSTANCE,
      OracleTypeRegistry.INSTANCE);

  private String driverClass;
  /**
   * 代码生成sql提供接口
   */
  private SqlProvider sqlProvider;
  /**
   * 数据库类型接口注册器
   */
  private TypeRegistry typeRegistry;


  Database(String driverClass, SqlProvider sqlProvider, TypeRegistry typeRegistry) {
    this.driverClass = driverClass;
    this.sqlProvider = sqlProvider;
    this.typeRegistry = typeRegistry;
  }

}
